﻿<UserControl x:Class="Ops.Mpc.ExampleApplication.Polling.PollingControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:presenters="clr-namespace:Ops.Mpc.Presenters;assembly=Ops.Mpc"
    xmlns:controllers="clr-namespace:Ops.Mpc.Controllers;assembly=Ops.Mpc"   
    xmlns:states="clr-namespace:Ops.Mpc.States;assembly=Ops.Mpc"   
    xmlns:pollingmodels="clr-namespace:Ops.Mpc.ExampleApplication.Polling.Models"    
    xmlns:pollingitemcontrols="clr-namespace:Ops.Mpc.ExampleApplication.Polling.Controls" 
    xmlns:actions="clr-namespace:Ops.Mpc.ExampleApplication.Actions" 
    d:DesignHeight="300" d:DesignWidth="400">

    <presenters:Presenter x:Name="Presenter1" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
        <controllers:Controller>
            <controllers:Controller.Models>
                <pollingmodels:PollingModel ItemName="PollingModel" />
            </controllers:Controller.Models>
            <controllers:Controller.States>
                <states:State ItemName="DefaultState" AutoRun="True"   >
                    <states:StateTemplate>
                        <Grid>
                            <ItemsControl ItemsSource="{Binding Models[PollingModel].PollingItems}" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <pollingitemcontrols:PollingItemControl Margin="10" />
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </Grid>
                    </states:StateTemplate>
                    <states:State.StateActions>
                        <actions:SetMainMessageStateAction ItemName="SetMainMessageStateAction" MessageId="PollingMessage" />
                    </states:State.StateActions>
                </states:State>
            </controllers:Controller.States>
        </controllers:Controller>
    </presenters:Presenter>
</UserControl>
